<?php
/**
 * Created by PhpStorm.
 * User: JYuans
 * Date: 2019/12/12
 * Time: 16:02
 */
namespace Mhome\Controller;

class ExamineController extends MhomeController {

    /**
     * 获取考核列表接口
     */
    public function getExamineList(){
        $start_examine_list = array();
        $not_begin_examine_list = array();
        $complete_examine_list = array();
        $end_examine_list = array();

        $mid_examine = new MidExamineController();
        $mid_examine_list = $mid_examine->getUserMidExamineList();
        foreach($mid_examine_list as $key=>$value){
            if($value['status'] == 0){
                $not_begin_examine_list[] = $value;
            }elseif ($value['status'] == 1){
                $start_examine_list[] = $value;
            }elseif ($value['status'] == 2){
                $end_examine_list[] = $value;
            }elseif ($value['status'] == 3){
                $complete_examine_list[] = $value;
            }
        }

        $team_examine = new TeamExamineController();
        $team_examine_list = $team_examine->getUserTeamExamineList();
        foreach($team_examine_list as $key=>$value){
            if($value['status'] == 0){
                $not_begin_examine_list[] = $value;
            }elseif ($value['status'] == 1){
                $start_examine_list[] = $value;
            }elseif ($value['status'] == 2){
                $end_examine_list[] = $value;
            }elseif ($value['status'] == 3){
                $complete_examine_list[] = $value;
            }
        }

        $examine_list = array_merge($start_examine_list,$not_begin_examine_list,$complete_examine_list,$end_examine_list);

        if(!$examine_list){
            $this->returnJson(503,"无数据");
        }

        $this->successReturn("获取成功",['list_data'=>$examine_list]);
    }
}